package com.zc.study.thread.多线程第四章节.thread4_1_8;

import java.lang.reflect.Method;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class Service {
    private Lock lock;

    public Service(boolean isFair) {
        this.lock = new ReentrantLock(isFair);
    }

    public void aWait(){
        lock.lock();
        System.out.println("threadName="+Thread.currentThread().getName()+"获得锁定");
        lock.unlock();
    }
}
